package com.zheng.hr.rpc.service.impl;

import com.zheng.common.annotation.BaseService;

import com.zheng.hr.dao.model.HrTrainUser;
import com.zheng.hr.dao.mapper.HrTrainUserMapper;
import com.zheng.hr.rpc.api.HrTrainUserService;
import com.zheng.common.base.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author likun
 * @since 2018-03-14
 */
@Service
@Transactional(rollbackFor = Exception.class)
@BaseService
public class HrTrainUserServiceImpl extends BaseServiceImpl<HrTrainUserMapper, HrTrainUser> implements HrTrainUserService {
    @Autowired
    private HrTrainUserMapper trainUserMapper;

    public List<Map<String, Object>> selectTrainUsers(Integer trainId) {
        return trainUserMapper.selectTrainUsers(trainId);
    }

    public boolean updateTrainUsers(List<HrTrainUser> trainUsers) {
        for (HrTrainUser trainUser : trainUsers) {
            updateById(trainUser);
        }
        return true;
    }
}
